import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        //定义变量
        double toothbrush = 8.8;
        double towel = 10.0;
        double cup = 18.8;
        double apple = 12.5;
        double banana = 15.5;
        String i="";
        String a = "y";

        //打印
        System.out.println("--------------------------黑马小商场--------------------------");
        System.out.println("1、牙刷的价格为："+toothbrush+"元");
        System.out.println("2、毛巾的价格为："+towel+"元");
        System.out.println("3、水杯的价格为："+cup+"元");
        System.out.println("4、苹果的价格为："+banana+"元");
        System.out.println("5、香蕉的价格为："+apple+"元");

        //循环
        while (a.equals("y") || a.equals("A")){
            //获得用户的键入
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入你需要的物品");
            i = scanner.next();
            //商品需求
            switch (i){
                case "1":
                    System.out.println("请输入你需要买的牙刷数量");
                    int toothbrushnumber  = scanner.nextInt();
                    double toothbrushnum = toothbrushnumber*toothbrush;
                    System.out.println("你买了牙刷"+toothbrushnumber +"支"+toothbrushnum + "元");
                    System.out.println("需要购买请输入y,退出输入n");
                    a = scanner.next();
                    break;
                case "2":
                    System.out.println("请输入你需要买的牙刷数量");
                    int towelnumber  = scanner.nextInt();
                    double towelnum = towelnumber*toothbrush;
                    System.out.println("你买了毛巾"+towelnumber +"条"+towelnum + "元");
                    System.out.println("需要购买请输入y,退出输入n");
                    a = scanner.next();
                    break;
                case "3":
                    System.out.println("请输入你需要买的牙刷数量");
                    int cupnumber  = scanner.nextInt();
                    double cupnum = cupnumber*toothbrush;
                    System.out.println("你买了牙杯"+cupnumber +"个"+cupnum + "元");
                    System.out.println("需要购买请输入y,退出输入n");
                    a = scanner.next();
                    break;
                case "4":
                    System.out.println("请输入你需要买的牙刷数量");
                    int applenumber  = scanner.nextInt();
                    double applenum = applenumber*toothbrush;
                    System.out.println("你买了苹果"+applenumber +"个"+applenum + "元");
                    System.out.println("需要购买请输入y,退出输入n");
                    a = scanner.next();
                    break;
                case "5":
                    System.out.println("请输入你需要买的牙刷数量");
                    int banananumber  = scanner.nextInt();
                    double banananum = banananumber*toothbrush;
                    System.out.println("你买了香蕉"+banananumber +"个"+banananum + "元");
                    System.out.println("需要购买请输入y,退出输入n");
                    a = scanner.next();
                    break;
                default:
                    System.out.println("输入有误重新输入");
                    break;
            }
        }
        System.out.println("欢迎下次光临");
    }
}